package it.ma.musicplayernew.holder;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.zhongdao.swing.R;

import it.ma.musicplayernew.modle.MusicEntity;

/**
 * @包名: it.ma.musicplayernew.holder
 * @作者: Victor
 * @创建时间 : 2015/9/15 9:58
 * @描述: TODO
 */
public class MusicItemHolder extends BaseViewHolder<MusicEntity>{

    @ViewInject(R.id.row_title)
    private TextView mTitle;

    @ViewInject(R.id.row_indicator)
    private ImageView mIndicator;

    public MusicItemHolder(Context context) {
        super(context);
    }

    @Override
    protected View initView() {
        View view = View.inflate(mContext, R.layout.row, null);

        ViewUtils.inject(this, view);

        return view;
    }

    @Override
    protected void refreshView(MusicEntity data) {
        mIndicator.setVisibility(data.isPlaying ? View.VISIBLE : View.INVISIBLE);
        mTitle.setText(data.tag);
    }
}
